George Garside Blog

A place of many ramblings about macOS and development. If you find something useful on here, it's probably an accident.

I’ve suffered from an odd bug for a while on iOS 7, where the cellular data app preferences that I set in Settings → Cellular (Mobile in the UK) for each of the individual apps on my iOS 7 device wasn’t getting saved. I could slide the switch on or off, and when I leave the app and return, the settings would be back to how they were.

This became a large problem, especially on my limited data plan where every megabyte was precious and limited. I had to do something to fix this. The only thing I found that people seemed to find to fix it was to restore. However, I was their device probably wasn’t jailbroken.

My iPhone is jailbroken. This means that I can look in the device’s filesystem and see exactly the file that I need. I was expecting to look for the file and either see something blatantly wrong with it and fix it, or simply change the variables there instead of in the Settings app (I don’t change settings that often—I wouldn’t mind changing the setting in iFile/etc if required).

This wasn’t as easy as I expected. For starters, I couldn’t find the file. I was expecting a property list somewhere in ~/Library/Preferences, but that didn’t happen. After concluding that I must be looking in completely the wrong place, I got an answer from Andrew over at Ask Different.

The directory you’re looking for happens to be /var/wireless/Library/Preferences. This is where the Settings > Cellular settings are stored. The per-application settings are stored in the database /var/wireless/Library/Databases/CellularUsage.db.

With my new-found knowledge, I looked at the database at /var/wireless/Library/Databases/CellularUsage.db using Navicat on my Mac (over Netatalk) and found what I was looking for—all the app cellular data preferences. I could change a value and have the change reflected in Settings. This meant that Settings was reading the database but was for some reason unable to write to it. I tried many things including permissions on both the database and the app, but everything seemed fine.

Finally, I just tried deleting it from my device. Everything was back to normal—the settings were saving and the database was getting written to!

This has occurred again with the update to iOS 9. If you update to iOS 9 OTA (over-the-air), a bug can cause the CellularData.db to become corrupted. Unfortunately, a jailbreak isn't available for iOS 9 yet, which means that this fix doesn't apply yet. Once a jailbreak is released, this solution will work fine. Until then, a workaround is to restore iOS and not restore from your backup. This will create a new CellularData.db database which works fine.

iOS 9.0.2 update fixes this bug. You can install this update OTA through Settings → Software Update, or through iTunes.

This update contains bug fixes and improvements, including: Fixes an issue with the setting to turn on or off app mobile data usage

Leave a Reply

4

Thank you so much! I've been plagued with this problem myself ever since iOS 7.0.6 (upgrading to 7.1.2 or restoring didn't fix it). Just like you I've searched everywhere through different preferenxe files. Makes you wonder how non jailbroken devices would have fixed the problem.. Thanks again 🙂

Reply
0

Ah okay. I figured a respring would work, but a reboot did the trick. Thanks again.

Reply
0

Thank you so much! Finally someone else with the same problem. Your guide was very helpful and informative, however I have an issue. My symptoms mirror exactly what happened with you, however after deleting those database files and other preference files and cache files (which self-regenerated), there are "still" certain apps I can't turn cellular data off for! (E.g. Passbook, Photos, Notes, mainly standard Apple apps). Downloaded apps can be switched on and off though (usually). Any suggestions?

Reply
0

Hang on what file did you delete exactly? What was it called?

Reply